﻿using Demo.EventBus;
using System;
using System.Threading;


/// <summary>
/// 测试代码
/// </summary>
public class Program
{
    public static void Main()
    {
        // 启动事件总线
        EventBus.Start();

        //模拟注册用户
        dynamic registerUser = new
        {
            userId = 1,
            userName = "阿C",
            userEmail = "acc@live.com",
            eventTime = DateTime.Now
        };

        // 用户注册
        EventBus.Publish("Register", registerUser);

        // 模拟延迟以确保事件处理
        Thread.Sleep(2000);

        //用户登录事件
        dynamic loginUser = new
        {
            userId = 2,
            userName = "Alan",
            userEmail = "Alan@live.com",
            eventTime = DateTime.Now
        };
        EventBus.Publish("Login", loginUser);

        Console.ReadKey();

    }
}


